package dzz.Week1;

/**
 * @author dzz
 */
public class LeetCode1108_DefangingAnIPAddress {

    // for 循环
    class SolutionFor {
        public String defangIPaddr(String address) {
            String defangingAddress = "";
            for (String s : address.split(".")) {
                defangingAddress = defangingAddress + s;
            }
            return defangingAddress;
        }
    }

    // replace 替换
    class SolutionReplace {
        public String defangIPaddr(String address) {
            return address.replace(".", "[.]");
        }
    }

}
